from django.db import models


# Create your models here.
# name  有生命, title 标题, 没生命
class Area(models.Model):
    title = models.CharField('分区', max_length=24)
    fee = models.IntegerField('费用/小时', default=10)

    class Meta:
        db_table = 'tb_area'

    def __str__(self):
        return '%s-%s' % (self.title, self.fee)


class Pc(models.Model):
    area = models.ForeignKey(Area, on_delete=models.SET_NULL, null=True)
    number = models.CharField('编号', max_length=24)
    is_online = models.BooleanField('是否上机', default=False)

    class Meta:
        db_table = 'tb_pc'

    def __str__(self):
        return '%s-%s-%s' % (self.area.title, self.number, self.is_online)
